#ifndef SLEPFILEOPERATIONS_H
#define SLEPFILEOPERATIONS_H

#include <QString>
#include "slepbase.h"


class SLEPItem{

public:
    SLEPItem();
    ~SLEPItem();

    void dealloc();
    QString info();

    static const int NONE = 0;
    static const int SINGLE_VALUE = 1;
    static const int DENSE_MATRIX = 2;
    static const int IJV_MATRIX = 3;
    static const int SPARSE_MATRIX_CSC = 4;
    static const int SPARSE_MATRIX_CSR = 5;
    static const int DENSE_VECTOR = 6;
    static const int SPARSE_VECTOR = 7;
	static const int GROUP_INDICES = 8;

    static const char *TYPES_LONG[] ;
    static const char *TYPES_SHORT[];

    int type; // is any of the above types

    double *data;
    double singlevalue;
    int m;
    int n;
    int dimension;
    int *spvec_index;
    int *ijvmat_i;
    int *ijvmat_j;
    int nnz;// for sparse vector and ijv_matrix
    int *cscmat_cols; // of size n+1
    int *cscmat_rowindex; // of size cscmat_cols[n]

    int *csrmat_rows; // of size m+1
    int *csrmat_colindex; // of size csrmat_rows[m]

	int *group_index;
	int group_size;

};




namespace SLEPFileOperations
{
    SLEPItem readFile(QString filename);
    bool writeFile(SLEPItem item, QString filename);
    SLEPItem readTextFile(QString filename);
    bool writeTextFile(SLEPItem item, QString filename);
	SLEPItem* slepMatrix2SlepItem(slep_matrix* matrix);
	SLEPItem* slepVector2SlepItem(slep_vector* vector);
	slep_matrix* slepItem2SlepMatrix(SLEPItem* item);
	slep_vector* slepItem2SlepVector(SLEPItem* item);
}

#endif // SLEPFILEOPERATIONS_H
